package cn.hznc.repository;

import cn.hznc.domain.entity.InventoryLocationEntity;
import cn.hznc.domain.entity.ToolPartEntity;
import cn.hznc.domain.entity.WarehouseEntity;
import cn.hznc.domain.request.inventory.*;

import cn.hznc.domain.request.retrospect.ToolRetrospectIndexReq;
import cn.hznc.domain.request.toolAnalyze.ToolConsumptionandUsageAnalysisReq;
import cn.hznc.vo.*;
import io.swagger.models.auth.In;
import org.apache.ibatis.annotations.Param;

import java.util.Date;
import java.util.List;
import java.util.Map;


/**
 * @Author：Administrator
 * @Date：2023/4/2 16:45
 */
public interface InventoryLocationRespository{

    List<String> getGoodsAreaNames(@Param("type")String type);

    List<WarehouseSimpleVo> getWarehouseList(QueryWarehouseReq queryWarehouseReq);

    List<InventoryLocationEntity> getLocationList(@Param("warehouseId") Integer warehouseId);

    List<InventoryLocationVo> getLocationToolChildList(@Param("inventoryLocationId") Integer inventoryLocationId);

    List<InventoryLocationVo> getLocationAssemblyToolChildList(@Param("inventoryLocationId") Integer inventoryLocationId);

    List<LocationToolVo> getLocationToolList(@Param("inventoryLocationId")Integer inventoryLocationId , @Param("searchContent") String searchContent);

    List<LocationToolVo> getLocationAssemblyToolList(@Param("inventoryLocationId")Integer inventoryLocationId ,@Param("searchContent") String searchContent);

    List<InboundAndOutboundVo> queryInboundAndOutbound(@Param("id") Integer id , @Param("searchContent") String searchContent);

    Integer countLocationNum(@Param("warehouseId") Integer warehouseId);

    Integer getInventory(@Param("id")Integer id ,@Param("type")String type);

    LocationNameVo queryLocation(@Param("id") Integer id);

    List<LocationNameVo> queryLocationByLocationId(@Param("locationIds") List<Integer> locationIds);
    LocationNameVo queryLocationByInventoryLocationId(@Param("inventoryLocationId") Integer inventoryLocationId);


    List<LocationUsageVo> getLocationUsageLog(LocationUsageReq locationUsageReq);

    List<LocationUsageVo> getLocationAssemblyToolUsageLog(LocationAssemblyToolUsageReq locationAssemblyToolUsageReq);

    List<AssemblyToolPartVo> getToolAllocationStatusByLogs(ToolAllocationReq toolAllocationReq);

    List<AssemblyToolPartVo> getToolAllocationStatus(ToolAllocationReq toolAllocationReq);

    Map<String, String> qryRowAndColumn(Integer warehouseId);

    void addInventoryLocation(InventoryLocationEntity inventoryLocationEntity);

    void updateInventoryLocationById(InventoryLocationEntity inventoryLocationEntity);

    Integer insertShelves (WarehouseEntity addShelvesReq);

    Integer updateShelves (WarehouseEntity addShelvesReq);

    Integer deleteShelvesById (Integer id);

    Map<String, Integer> queryCapacity(@Param("inventoryLocationId") Integer inventoryLocationId);

    String getSafetyInventory(Integer inventoryLocationId);

    InventoryLocationEntity getById(Integer inventoryLocationId);

    List<String> selectLocationNumList(Integer id);

    void deleteShelveWarehouse (@Param("warehouseId") Integer warehouseId);

    Integer getTotalInventoryByPartno(@Param("partno") String partno);
    Integer getTotalInventoryByToolNo(@Param("toolNo") String toolNo);

    Integer getIdByTypenameAndType(@Param("typename")String typename ,@Param("type")String type);

    void  updateSafetyCapcacityById(@Param("id") Integer id,@Param("safetyCapacity")String safetyCapacity);

    String selectSafetyCapacityByid(@Param("id") Integer id);

    List<Map<String, Object>> selectLocationNumByWarehouseId(@Param("warehouseId") Integer warehouseId , @Param("toolNo") String toolNo);

    List<InventoryLocationEntity>  selectByWarehouseId(@Param("warehouseId")Integer warehouseId);

    List<InventoryLocationEntity> selectInventoryLocation(@Param("warehouseId")Integer warehouseId,@Param("selectMessage")String selectMessage);


    //List<LocationNumVo> selectLocationByLocationNum(@Param("locationNum") String locationNum , @Param("warehouseId") Integer warehouseId);

    void delectInventoryLocation (@Param("warehouseId") Integer warehouseId ,@Param("delectInventoryLocation") String delectInventoryLocation);

    LocationNameVo getLocationNameById(@Param("id") Integer inventoryLocationId , @Param("type") String type);

    Map<String , Object> getWarehouseNameAndType(@Param("inventoryLocationId") Integer inventoryLocationId);

    void insertBatch(List<InventoryLocationEntity> insertEntities);

    Map<String, Object> getLocationInventory(String type);

    void updateCapacityById(InventoryLocationEntity inventoryLocationEntity);

    List<InventoryLocationEntity> selectAll();

    void insert(InventoryLocationEntity inventoryLocationEntity);

    /**
     * 报废货架单独使用(报废货架只有一个报废库位)
     * @param s
     * @return
     */
    Integer selectIdByWarehouseName(@Param("s") String s);

    Integer selectIdByWarehouseNameReload(@Param("s") String s);

    /**
     * 智能柜库位查询单独使用(智能柜库位编号唯一)
     * @param position
     * @return
     */
    Integer queryIdByLocationNum(@Param("position") String position);

    List<LocationNumberVo> getByWarehouseIdAndPartno(@Param("warehouseType") String warehouseType,@Param("partno") String partno , @Param("number") Integer number);

    List<Integer> selectLocationId(ToolRetrospectIndexReq toolRetrospectIndexReq);

    List<Integer> selectLocationIds(QueryAllToolPartReq queryAllToolPartReq);

    List<Integer> selectLocationIdsReload(@Param("warehouseSearchTypes") String warehouseSearchTypes , @Param("warehouseSearchId") Integer warehouseSearchId , @Param("locationSearchId") Integer locationSearchId);

    void updateById(InventoryLocationEntity inventoryLocationEntity);

    List<InventoryLocationEntity> qryLocation(@Param("locationNum") String locationNum);

    List<InventoryLocationEntity> qryLocationReload(@Param("warehouseId") Integer warehouseId,@Param("locationNum") String locationNum);

    List<LocationNumVo> selectLocationByLocationNum(@Param("locationNum")String locationNum,@Param("warehouseId") Integer tranWarehouseId);

    Integer countByStatus(@Param("warehouseId") Integer warehouseId , @Param("status")Integer status);

    InventoryLocationEntity selectByLocationNum(@Param("locationNum") String locationNum);

    InventoryLocationEntity selectByAllTypeLocation(@Param("warehouseId") Integer warehouseId, @Param("locationNum") String allType);

    Integer countNumberByLocationId(@Param("id") Integer id);

//<<<<<<< Updated upstream
    List<InventoryLocationEntity> selectBackUpLocation();

    String queryLocationNumById(@Param("inventoryLocationId") Integer inventoryLocationId);

    Integer queryIdByLocationNumAndSncode(@Param("position") String position,@Param("snCode") String value);

    List<Integer> selectLocationIdByLocationNum(ToolConsumptionandUsageAnalysisReq toolRetrospectIndexReq);

    void updateDate(@Param("icabinetPullTime") String icabinetPullTime,@Param("date") String date);

    List<WarehouseNameVo> getWarehouseByToolNo(@Param("toolNo") String toolNo , @Param("type") String type);

    LocationNameVo queryLocationById(@Param("id") Integer id);

    Integer queryStatusByLocationId(@Param("locationId") Integer locationId);

    List<LocationNumberVo> qryFeedLocationNum(@Param("warehouseType") String warehouseType,@Param("partno") String partno);

    List<String> transferLocationName(List<Integer> locationIds);

    List<InventoryLocationEntity> selectListByWarehouseId(@Param("warehouseId") Integer warehouseId , @Param("id")Integer id);

    void updateLocationIdById(@Param("id") Integer id);

    List<InventoryLocationEntity> selectAllList();

    List<Integer> selectLocationIdByLocationNums();

    List<Integer> selectLocationIdsByWarehouseType(@Param("warehouseType") String warehouseType);

    Integer selectByCondition(@Param("row") String s,@Param("column") String s1,@Param("warehouseName") String warehouseName);

    List<Integer> queryByWarehouseName(@Param("warehouseName") String warehouseName);

    void updateStatusByWarehouseIds(@Param("warehouseIds")List<Integer> warehouseIds, @Param("status")Integer status);

    List<Integer> selectAllTypeLocationIds(@Param("warehouseType") String warehouseType);

    void updateDateList(List<InventoryLocationEntity> updateList);

    List<ToolPartEntity> queryByToolNo(@Param("toolNo") String toolNo);

    String qryEquipmentNameById(@Param("id")Integer id);

    List<InventoryLocationEntity> selectAllListByWarehouseType(@Param("warehouseType") String warehouseType);

    void updateBatch(@Param("list") List<InventoryLocationEntity> updateList);

    void update(InventoryLocationEntity inventoryLocationEntity);


    List<LocationIdVo> selectLocationIdList();

    List<Integer> selectWarehouseIds();
}
